package org.example.day20240819;

import java.util.Random;

public class Main {
    public static void main(String[] args) {
//        Point point = new Point(1, 1);
//        Circle circle = new Circle(point, 1);
//        Point point2 = new Point(2,2);
//        System.out.println(circle.isPointInCircle(point2));
//        Point point2 = new Point(3, 2);
//
//        System.out.println(point.getDistance(point2));
//        System.out.println(point2.getDistance(point));
        Point heart = new Point(1,1);
        Circle circle = new Circle(heart,1);
        int count = 0;
        for(int i=0; i<1000000; i++){
            Random random = new Random();
            double x= random.nextDouble()*2;
            double y= random.nextDouble()*2;
            Point point = new Point(x,y);
            if(circle.isPointInCircle(point)){
                count++;
            }
        }
        System.out.println(4.0*count/1000000);
    }
}
